package appconfig

import (
	"fmt"
	"github.com/spf13/viper"
)

type Mysql struct {
	Host     string
	Port     int
	User     string
	Password string
	Database string
}
type AppConfig struct {
	Mysql Mysql
}

var Config AppConfig

func Init() {
	viper.SetConfigFile("appconfig/dev.yaml")
	err:=viper.ReadInConfig()
	if err!=nil{
		panic(err)
	}
	err=viper.Unmarshal(&Config)
	if err!=nil{
		panic(err)
	}
	fmt.Println("配置文件加载成功: ",Config)
}
